<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
	<title>问诊详情</title>
	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">		
	<link rel="stylesheet" href="css/mui.min.css">
	<link rel="stylesheet" href="css/grandeHealth.css">
	<link rel="stylesheet" type="text/css" href="css/myList.css"/>
	</head>
	<body>
		<!--<header>class="mui-bar mui-bar-nav" style="display: block;height: 64px;padding-top:20px">
	      <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	    </header>-->
		<!--下拉刷新容器-->
	    <div class="mui-scroll-wrapper" id="pullrefresh">
	      <div class="mui-scroll">
	        <!-- 数据列表 -->
	        <ul class="mui-table-view">
				<!--<li class="mui-table-view-cell">
					<a href="javascript:;"> 
						<div class="mui-media-body"> 
							<span class="kaoheDate" style="color: #39AAE7;">查看病历</span> 
							<p class="name">2017-07-31</p> 
						</div> 
					</a>
				</li>-->
	       </ul>
	      </div>
	    </div>
	    <!--暂无记录-->
	    <div class="mui-content" style="display: none;">
	      <div class="nomessage">
	        <img src="images/zanwujilu.png" />
	        <p>暂无记录</p>
	      </div>
	    </div>    
		<script src="js/jquery-1.7.2.min.js"></script>
		<script src="js/mui.minT.js"></script>
		<script src="js/grandeHealth.js"></script>
		<script src="js/medicalRecord.js"></script>
		<script src="js/recordList.js"></script>
		<script>

			/**
		       * 页面初始化
	     	*/
			mui.init({
		        pullRefresh: {
		          	container: '#pullrefresh',
		          	down: {
		          		auto: true,
            			callback: pulldownRefresh,
		          	},
	          		up: {
			            contentrefresh: '正在加载...',
			            callback: pullupRefresh,
				      	contentnomore:'没有更多数据了'//可选，请求完毕若没有更多数据时显示的提醒内容；
	          		}
		        }
	      	});
	      	
			var BLGUID = GetLocationParam('caseGuid');//病历guid
			var webUrl = XHDOC_WEBBASE + "dtcasehistory/getinterrogation?&pageSize=10&sickguid="+BLGUID;
	      	/**
		       * 下拉刷新具体业务实现
	     	*/
	      	function pulldownRefresh() {
	      		
	      		setTimeout(function () {
	     			
	     			count = 1;
	     			webUrl;
	     			_recordList(webUrl, { 'pageNo': count }, function (data) {
						
						var table = document.body.querySelector('.mui-table-view');
						table.innerHTML = '';
						
						//最新数据
						addContent(data, table);
						
						mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
						mui('#pullrefresh').pullRefresh().endPullupToRefresh(null, "正在加载...");
						count++;
					});
					
	          	}, 1000);
	      	}
	
		    /**
		     * 上拉加载具体业务实现
		     */
	      	function pullupRefresh() {
	      		
	      		setTimeout(function () {
				
					webUrl;
					_recordList(webUrl, { 'pageNo': count }, function (data) {
						
						var table = document.body.querySelector('.mui-table-view');
						
						//最新数据
						if (arry.parameterType == '') {
							
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(null, "没有更多数据了");
	
						} else {
							
							//最新数据
							addContent(data, table);
							count++;
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(null, "正在加载...");
						}
					});
	
				}, 1000);

	      	}
	
	      	
	      	function addContent(arry, table) {
				
				if (arry.parameterType == '') {
							
					$('.mui-content').show();

				} else {

					$('.mui-content').hide();
					
					for (var i = 0; i < arry.parameterType.length; i++) {
					
						var li = document.createElement('li');
			            li.className = 'mui-table-view-cell mui-media';	
			            console.log(arry.parameterType[i])
						var dateTime = arry.parameterType[i].crtdat;
						var mydate=dateTime.substr(0,10); 
						li.innerHTML = 
								'<a href="javascript:;" name="'+arry.parameterType[i].guid+'">'+
									'<div class="mui-media-body">'+
										'<span class="kaoheDate" style="color: #39AAE7;">查看病历</span>'+
										'<p class="name">'+mydate+'</p>'+
									'</div>'+
								'</a>';
						table.appendChild(li);
					}
				}
			}
			
		  	
		  	//查看病历
			mui("body").on("tap", ".mui-table-view li a span", function() {
				showpage('view_medical_record.html?caseGuid='+$(this).parents('a').attr('name'));

			})
					      	      						
			//返回箭头事件
//			mui.back = function() {		
//				try {
//					
//					if(XHDOC_BROWSETYPE == 'IOS') {
//					
//						//调用ios的返回事件
//						
//					} else if(XHDOC_BROWSETYPE == 'ANDROID') {
//	
//						//调用ANDROID的返回事件
//	
//					}		
//		
//				} catch(e) {
//					console.log(e);
//				}		
//			}			
	    </script>
	</body>
</html>


